package org.apache.rocketmq.console.controller;

import org.apache.rocketmq.console.script.dao.EnvInfoDao;
import org.apache.rocketmq.console.script.dao.EnvironDicDao;
import org.apache.rocketmq.console.script.dao.RegionInfoDao;
import org.apache.rocketmq.console.script.dao.ScriptInfoDao;
import org.apache.rocketmq.console.script.dao.SysInfoDao;
import org.apache.rocketmq.console.script.model.EnvInfo;
import org.apache.rocketmq.console.script.model.EnvironDic;
import org.apache.rocketmq.console.script.model.RegionInfo;
import org.apache.rocketmq.console.script.model.ScriptInfo;
import org.apache.rocketmq.console.script.model.SysInfo;
import org.apache.rocketmq.console.shiro.dao.UserInfoDao;
import org.apache.rocketmq.console.shiro.dao.UserPermissionDao;
import org.apache.rocketmq.console.shiro.entity.UserInfo;
import org.apache.rocketmq.console.shiro.entity.UserPermission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/my")
public class MyOperationController {
	@Autowired
	private EnvInfoDao envInfoDao;

	@Autowired
	private EnvironDicDao environDicDao;

	@Autowired
	private RegionInfoDao regionInfoDao;

	@Autowired
	private ScriptInfoDao scriptInfoDao;

	@Autowired
	private SysInfoDao sysInfoDao;

	@Autowired
	private UserInfoDao userInfoDao;

	@Autowired
	private UserPermissionDao userPermissionDao;

	@RequestMapping(value = "/envInfo.do", method = RequestMethod.POST)
	public Object saveEnvInfo(@RequestBody EnvInfo entity) {
		System.out.println("entity=========" + entity);
		EnvInfo save = envInfoDao.save(entity);
		return save;
	}

	@RequestMapping(value = "/environDic.do", method = RequestMethod.POST)
	public Object saveEnvironDic(@RequestBody EnvironDic entity) {
		System.out.println("entity=========" + entity);
		EnvironDic save = environDicDao.save(entity);
		return save;
	}

	@RequestMapping(value = "/regionInfo.do", method = RequestMethod.POST)
	public Object saveRegionInfo(@RequestBody RegionInfo entity) {
		System.out.println("entity=========" + entity);
		RegionInfo save = regionInfoDao.save(entity);
		return save;
	}

	@RequestMapping(value = "/scriptInfo.do", method = RequestMethod.POST)
	public Object saveScriptInfo(@RequestBody ScriptInfo entity) {
		System.out.println("entity=========" + entity);
		ScriptInfo save = scriptInfoDao.save(entity);
		return save;
	}

	@RequestMapping(value = "/sysInfo.do", method = RequestMethod.POST)
	public Object saveSysInfo(@RequestBody SysInfo entity) {
		System.out.println("entity=========" + entity);
		SysInfo save = sysInfoDao.save(entity);
		return save;
	}

	@RequestMapping(value = "/userInfo.do", method = RequestMethod.POST)
	public Object saveUserInfo(@RequestBody UserInfo entity) {
		System.out.println("entity=========" + entity);
		UserInfo save = userInfoDao.save(entity);
		return save;
	}

	@RequestMapping(value = "/userPermission.do", method = RequestMethod.POST)
	public Object saveUserPermission(@RequestBody UserPermission entity) {
		System.out.println("entity=========" + entity);
		UserPermission save = userPermissionDao.save(entity);
		return save;
	}
}
